function isValidMAC(mac){
	var regex=/^([0-9a-f]{2}([:-]|$)){6}$|([0-9a-f]{4}([.]|$)){3}$/i;
	return regex.test(mac);
}

function getXml(url, successCallback, errorCallback){
	var xhr = getXhr();
	xhr.onreadystatechange = function(){
		if (this.readyState == 4) {
  		if(this.status == 200){
    		successCallback(this, this.userData);
	    }
      else{
      	if(errorCallback){
	      	errorCallback(this, this.userData);
	      }
  	    else{
    	    successCallback(this, this.userData);
      	}
    	}
  	}
 	}
	
	xhr.open("GET", url, true);
  xhr.send(null);
}


/*
 * this function returns an XmlHttpRequestObject
 * see
 * http://www.w3.org/TR/2009/WD-XMLHttpRequest-20090820/
 * for further details
 */
function getXhr() {
    var xmlhttp;
    /*@cc_on
   @if (@_jscript_version >= 5)
     try {
       xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
     } catch (e) {
       try {
         xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
       } catch (E) {
         xmlhttp = false;
       }
     }
   @else
   xmlhttp = false;
   @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
        try {
            xmlhttp = new XMLHttpRequest();
        } catch (e) {
            xmlhttp = false;
        }
    }
    return xmlhttp;
}
